<template>
    <div>
        <h2>会员级别信息</h2>
        <table class="table table-bordered">
            <tbody>
                <tr class="bg-primary">
                    <td>Id</td>
                    <td>会员等级名称</td>
                    <td>累计最低消费额（元）</td>
                    <td>操作</td>
                </tr>

                <tr v-for="item in quertinfo.data" :key="item.Id">
                    <td>{{item.Id}}</td>
                    <td>{{item.Name}}</td>
                    <td>{{item.MinMoney}}</td>
                    <td>
                        <input type="button" value="修改" class="btn btn-primary" @click="upd(item.Id)">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'
import axios from 'axios';
import { useRoute,useRouter } from 'vue-router';
const route=useRoute();
const router=useRouter();
import moment from 'moment';

//修改
const upd=(id:any)=>{
    router.push({
        path:'/levelupd',
        query:{
            id:id
        }
    })
}

//生命周期函数
onMounted(()=>{
 showlevel();
})


let quertinfo:any=reactive({
    data:[]
})

const showlevel=()=>{
    axios({
        method:'get',
        url:'/api/Week/Showlevel'
    })
    .then(res=>{
        console.log(res);
        quertinfo.data=res.data
    })
    .catch(err=>{
        console.error(err);
    })
}
</script>

<style scoped>

</style>